/**
 * Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.queue.service;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jeeplus.common.utils.PageBean;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.modules.gxarea.entity.Community;
import com.jeeplus.modules.gxarea.mapper.BusinessMapper;
import com.jeeplus.modules.sys.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.queue.entity.Queue;
import com.jeeplus.modules.queue.mapper.QueueMapper;

/**
 * 排队记录Service
 * @author azj
 * @version 2024-09-29
 */
@Service
@Transactional(readOnly = true)
public class QueueService extends CrudService<QueueMapper, Queue> {
	@Autowired
	private QueueMapper queueMapper;
	public Queue get(String id) {
		return super.get(id);
	}
	
	public List<Queue> findList(Queue queue) {
		return super.findList(queue);
	}
	
	public Page<Queue> findPage(Page<Queue> page, Queue queue) {
		return super.findPage(page, queue);
	}

	public PageBean <Queue> findPageList(Page<Queue> page, Queue queue) {
		PageBean<Queue> pageBean = new PageBean<>();
		PageHelper.startPage(page.getPageNo(), page.getPageSize());
		List<Queue> list = queueMapper.findPageList(queue);
		PageInfo <Queue> pageInfo = new PageInfo<>(list);
		pageBean.setCrurentNum(page.getPageNo());
		pageBean.setPageSize(page.getPageSize());
		pageBean.setTotalNum((int) pageInfo.getTotal());
		pageBean.setTotalPageSize(pageInfo.getPages());
		pageBean.setDatas(pageInfo.getList());
		return pageBean;
	}

	@Transactional(readOnly = false)
	public void save(Queue queue) {
		super.save(queue);
	}
	
	@Transactional(readOnly = false)
	public void delete(Queue queue) {
		super.delete(queue);
	}
	/**
	 * findUserOffice
	 * 获取用户点位id
	 * @author azj
	 * @date 2020-05-18/下午1:43:15
	 */
	public String findUserOffice(String id){
		return queueMapper.findUserOffice(id);
	}
	
}